<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>NWSAPI HTML5 elements selection test</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script type="text/javascript" src="../../src/nwsapi.js"></script>
<style type="text/css">
abbr { Helvetica, sans-serif; font-weight: bold; }
mark { background-color: yellow; }
span { background-color: lime; }
.pass { background-color: lime; }
.fail { background-color: red; }
</style>
</head>

<body>

  <h1>&nbsp;Your Search Results</h1>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tbody><tr>
      <td colspan="7">You searched for: all records</td>
    </tr>
      <tr align="right">
      <td colspan="7">Showing matches 1 to 10 of 1405</td>
    </tr>
  	  <tr>
      <td colspan="7">&nbsp;</td>
    </tr>
    <tr>
      <td align="center"><strong>Photo</strong></td>
      <td><strong>Reg Number </strong></td>
      <td><strong>Make &amp; Model</strong></td>
      <td><strong>Colour</strong></td>
      <td><strong>Stolen From </strong></td>
      <td><strong>Date / Time stolen</strong></td>
      <td width="100%">&nbsp;</td>
    </tr>
    <tr class="TableRowLine">
      <td><img src="" width="64" height="1"></td>
      <td><img src="" width="90" height="1"></td>
      <td><img src="" width="110" height="1"></td>
      <td><img src="" width="75" height="1"></td>
      <td><img src="" width="100" height="1"></td>
      <td><img src="" width="290" height="1"></td>
      <td><img src="" width="1" height="1"></td>
    </tr>
          <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1429&amp;src=881407&amp;pn=0" id="AV11UXA">AV11UXA</a></td>
      <td>Mercedes-benz E Class Convertible </td>
      <td>White <br>    </td>
      <td>London</td>
      <td>23rd April 2015 Between midday and 3pm</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1428&amp;src=881407&amp;pn=0">LD64FKO</a></td>
      <td>Honda CB500F  </td>
      <td>Black <br>    </td>
      <td>London</td>
      <td>22nd April 2015 in the afternoon</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1427&amp;src=881407&amp;pn=0">YN58 LXV</a></td>
      <td>Peugeot XPS CT 125  </td>
      <td>Black <br>    </td>
      <td>Shropshire</td>
      <td>20th April 2015 Between midnight and 3am</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1426&amp;src=881407&amp;pn=0">YA08JZR</a></td>
      <td>PEUYGEOT PARTNER ORIGIN  </td>
      <td>White <br>    </td>
      <td>Staffordshire</td>
      <td>17th April 2015 Between 3am and 6am</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1425&amp;src=881407&amp;pn=0">DF03 KXB</a></td>
      <td>Baimo RSR 125  </td>
      <td>Blue <br>    </td>
      <td>Hampshire</td>
      <td>19th April 2015 Between midnight and 3am</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1424&amp;src=881407&amp;pn=0">YG62 CM0</a></td>
      <td>Audi A4  </td>
      <td>Grey <br>    </td>
      <td>West Midlands</td>
      <td>14th April 2015 Between midnight and 3am</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1423&amp;src=881407&amp;pn=0">FT10 FDV</a></td>
      <td>Seat Ibiza  </td>
      <td>White <br>    </td>
      <td>South Yorkshire</td>
      <td>9th April 2015 in the afternoon</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1422&amp;src=881407&amp;pn=0">RJ61 WRE</a></td>
      <td>Volkswagen Golf 1.6 TDi Bluemotion Tech Match </td>
      <td>Red <br>    </td>
      <td>Dyfed</td>
      <td>5th March 2015 Between 3pm and 6pm</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1421&amp;src=881407&amp;pn=0">SR11 HLO</a></td>
      <td>Mazda Mazda3 Takuya </td>
      <td>Silver <br>    </td>
      <td>London</td>
      <td>2nd April 2015 Between 9pm and midnight</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
      <tr>
      <td align="center"><img src="" style="padding-top:2px;padding-bottom:2px;"></td>
      <td><a href="http://www.twoc.co.uk/view_rec.htm?id=1420&amp;src=881407&amp;pn=0">TNZ 9284</a></td>
      <td>Citroen Berlingo GB9HXC </td>
      <td>White <br>    </td>
      <td>Bedfordshire</td>
      <td>16th March 2015 time unknown</td>
      <td><form style="display:inline;" action="/report_theft/step1.htm" method="post" enctype="application/x-www-form-urlencoded">
      </form>
      </td>
    </tr>
        <tr>
      <td colspan="7" class="TableRowLine"><img src="" width="1" height="1"></td>
    </tr>
  </tbody></table>

<script type="text/javascript">

window.onload = function() {

  function log(msg) {
    document.body.appendChild(document.createElement('div')).innerHTML = msg;
  }

  var i, temp, test, selectors = {
    'tbody > tr:nth-of-type(n+6):not(:nth-of-type(17)) > td:nth-of-type(2) > a:not(:nth-of-type(2))': 'AV11UXA'
  };

  log('--- TEST USING NW.Dom.select ---');

  for (i in selectors) {
    temp = NW.Dom.select(i)[0];
    test = temp && temp.id == selectors[i];
    log((test ? temp.innerHTML : 'FAIL') + ' <span class="' + (test ? 'pass' : 'fail') + '">' + i + '</span>');
  }

  log('--- TEST USING document.querySelectorAll ---');

  for (i in selectors) {
    temp = document.querySelectorAll(i)[0];
    test = temp && temp.id == selectors[i];
    log((test ? temp.innerHTML : 'FAIL') + ' <span class="' + (test ? 'pass' : 'fail') + '">' + i + '</span>');
  }

};

</script>

</body>
</html>
